<?php
$dataCheckbox=new data();

$dataCheckbox->table="[php_property:table]";
$dataCheckbox->where="[php_property:where]";
$dataCheckbox->orderby="[php_property:orderby]";

foreach ($dataCheckbox->getData() as $dataCheckboxItem)
    {
    echo '<label>
    <input type = "checkbox" name = "nm_[php_property:n_table]_[php_property:m_table]_' . $dataCheckboxItem['id'] . '" value = "1"';

    if (isset($_REQUEST["id"]))
        {

        $count=db::getValue("SELECT COUNT(1) FROM [php_property:n_table]_[php_property:m_table] 
      WHERE _[php_property:n_table]='" . $[php_property:var]["id"] . "' AND
      _[php_property:m_table]='" . $dataCheckboxItem["id"] . "'");

        if ($count > 0)
            {
            echo " checked=checked ";
            }
        }

    echo '/>';

    foreach (general::stringToArray('[php_property:field]') as $field) {
        //echo $dataCheckboxItem[strtolower('[php_property:field]')]." ";
        echo $dataCheckboxItem[strtolower($field)]." ";
    }
    
    echo '</label>';

    echo '<br />';
    }
?>